package com.octocat.servletdemo;

import jakarta.servlet.*;

import java.io.IOException;

/**
 * Author : Octocat
 * Date   : 2021/5/5
 */

public class HelloServlet implements Servlet {
    /**
     * 实现 Servlet时，出现 Cannot resolve symbol Servlet，缺少servlet-api.jar，需要右键工程 open module settings 添加 servlet-api.jar
     */
    @Override
    public void init(ServletConfig servletConfig) throws ServletException {

    }

    @Override
    public ServletConfig getServletConfig() {
        return null;
    }

    /**
     * 该方法是专门用来处理 请求和响应的
     * @param servletRequest
     * @param servletResponse
     * @throws ServletException
     * @throws IOException
     */
    @Override
    public void service(ServletRequest servletRequest, ServletResponse servletResponse) throws ServletException, IOException {
        System.out.println("Hello Servlet 被访问了！");
    }

    @Override
    public String getServletInfo() {
        return null;
    }

    @Override
    public void destroy() {

    }
}
